# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause

import sys

from bleak.backends.device import BLEDevice
from bleak.backends.scanner import AdvertisementData

class BleDeviceInfo(object):
    def __init__(self, device:BLEDevice = None, advertisement_data: AdvertisementData = None) -> None:
        self.__name = ""
        self.__address = ""
        self.__rssi = -999
        
        if (device is not None):
            self.__name = device.name
            self.__address = device.address
            
        if (advertisement_data is not None):
            self.__rssi = advertisement_data.rssi
        
    @property
    def name(self):
        return self.__name
    
    @name.setter
    def name(self, name):
        self.__name = name

    @property
    def address(self):
        return self.__address
    
    @address.setter
    def address(self, address):
        self.__address = address
        
    @property
    def rssi(self):
        return self.__rssi
    
    @rssi.setter
    def rssi(self, rssi):
        self.__rssi = rssi
